// 使用express开发的图书管理系统服务端
// 123
import express, {  Request, Response } from 'express'
import { addBook, delBook } from './routerHandler.js'
import cors from 'cors'

const server = express()
server.use(express.json())
server.use(cors())
// server.use(express.urlencoded({extended: true}))

server.post('/api/books', addBook)

server.delete('/api/books/:id', delBook)

server.put('/api/books/:id', (req, res) => {
})

server.get('/api/books/:id', (req, res) => {

})
server.get('/api/books', (req, res) => {

})

server.all('*', (req, res) => {
  res.status(404)
  res.send('你要访问的资源路径不存在')
})

server.listen(3000, () => {
  console.log('服务器已启动');
})
